/*
 * Created on 2009-11-12
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.database;

import java.io.UnsupportedEncodingException;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CqmsBranch {
	public int getBranchLevel(String branchid) throws SQLException{
	 int BranchLevel=0;
	 DataBase db2=new DataBase();
	 ResultSet rst2=null;
	 String sql="select BranchLevel from CQMS_Branch where branchid='"+branchid+"'";
	 rst2=db2.executeQuery(sql);
	 if(rst2.next()){
	 	BranchLevel=rst2.getInt("BranchLevel");
	 	
	 }
	 rst2.close();
	 db2.closeStmt();
	 db2.closeConn();
	 
	return BranchLevel;
	}
	public String getZhongWen(String str){
		try {
			str=new String(str.getBytes("iso8859_1"),"GBK");
		} catch (UnsupportedEncodingException e) {
			return "-1";
		}
		
	return str;
	}
	public String deleteBranch(String branchid){
		DataBase db2=new DataBase();
		String sql="delete from Cqms_Branch where branchid='"+branchid+"'";
		db2.executeUpdate(sql);
		db2.closeStmt();
		db2.closeConn();
		return "ok";
	}
}
